﻿@model GPS.ENTITYS.ViewModelSGIAIDOAN
@using PagedList.Mvc;
@using GPS.Helpers;

@{
    ViewBag.Title = "Danh mục giai đoạn";
    WebGrid grid = new WebGrid();
}
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/datepicker.js"></script>
<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">danh mục GIAI ĐOẠN</h3>
    <div class="row">
        <div class="row">
            @using (Html.BeginForm("Index", "GPS_GiaiDoan", FormMethod.Get))
            {
                <div class="list-group">
                    <fieldset class="fs_body">
                        <legend class="head_title">Điều kiện tìm kiếm</legend>
                        <div class="criteria_search">
                            <div class="row  margin-top-05">
                                <div class="col-md-2 control-label">
                                    Mã giai đoạn:
                                </div>
                                <div class="col-md-4">
                                    @Html.TextBoxFor(model => model.gGDOAN_MA, new { @class = "form-control" })
                                </div>

                                <div class="col-md-2 control-label">
                                    Đơn vị đào tạo:
                                </div>
                                <div class="col-md-4">
                                    @{
                if (ViewBag.checkuser == "40")
                {
                    @Html.TextBoxFor(model => model.gGDOAN_CSDT_MA, new { @class = "form-control", @id = "DVGTVT_MA" })
                }
                else
                {
                    @Html.TextBoxFor(model => model.gGDOAN_CSDT_MA, new { @class = "form-control", @readonly = "readonly" })
                }
                                    }

                                    @Html.ValidationMessageFor(model => model.gGDOAN_CSDT_MA)
                                    <span id="rDataDVGTVT_MA" style="width:500px;"></span>
                                    <div class="help-tip">
                                        <p>Gõ mã hoặc tên đơn vị để hiển thị danh sách đơn vị </p>
                                    </div>
                                </div>
                            </div>
                            <div class="row margin-top-05 btn_search">
                                @if (ViewBag.checkuser == "40")
                                {
                                    <div style="float: right; margin: 0 2px;">
                                        @Html.NoEncodeActionLink("<span class='glyphicon glyphicon-plus'></span> Thêm mới", "Thêm mới", "Create", "GPS_GiaiDoan", null, htmlAttributes: new { @class = "btn btn-warning btn-sm" })
                                    </div>
                                }
                                <button type="submit" class="btn btn-warning btn-sm">
                                    <span class="glyphicon glyphicon-search"></span> Tìm kiếm
                                </button>
                            </div>
                        </div>
                    </fieldset>
                </div>
            }
        </div>
        <div class="row">
            <fieldset class="fs_body">
                <legend class="head_title">Kết quả tìm kiếm</legend>
                <div class="row margin-top-05">
                    <div class="divbtnFielset">
                        <div style="float: right;">
                            <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng số bản ghi: @ViewBag.TotalRow</label>
                        </div>
                    </div>
                </div>
                <div class="row margin-top-05">
                    <table class="table table-striped table-hover table-bordered table-condensed">
                        <tr>
                            <th>
                                STT
                            </th>
                            <th>
                                Mã giai đoạn
                            </th>
                            <th>
                                Tên cơ sở đào tạo
                            </th>
                            <th>
                                Mô tả
                            </th>
                            <th>
                                Thao tác
                            </th>
                        </tr>
                        @{
                            if (Model.SearchResults != null)
                            {
                                foreach (var item in Model.SearchResults)
                                {
                                    <tr>
                                        <td align="center">
                                            @Html.DisplayFor(modelItem => item.STT)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.GDOAN_MA)
                                        </td>
                                        <td>
                                            @{
                                    foreach (var item1 in Model.listgiaothong)
                                    {
                                        if (item1.DVGTVT_MA == item.GDOAN_CSDT_MA)
                                        {
                                            @Html.Raw(item1.DVGTVT_TEN)
                                        }

                                    }
                                            }

                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.GDOAN_MOTA)
                                        </td>
                                        <td align="center">
                                            <a href="@Url.Action("Detail", "GPS_GiaiDoan", new { id = item.GDOAN_MA, id1 = item.GDOAN_CSDT_MA })" data-modal="">
                                                <img src="@Url.Content("~/fonts/grid-view-icon.png")" title="Xem chi tiết giai đoạn" />
                                            </a>
                                            @if (ViewBag.checkuser == "40")
                                            {
                                                <a href="@Url.Action("Edit", "GPS_GiaiDoan", new { id = item.GDOAN_MA, id1 = item.GDOAN_CSDT_MA })">
                                                    <img src="@Url.Content("~/fonts/grid-edit-icon.png")" title="Sửa giai đoạn" />
                                                </a>
                                                <a href="@Url.Action("Delete", "GPS_GiaiDoan", new { id = item.GDOAN_MA, id1 = item.GDOAN_CSDT_MA })" onclick="return confirm('Bạn Thật Sự Muốn Xóa Tiến Trình Xủ Lý Này!!!')">
                                                    <img src="@Url.Content("~/fonts/grid-delete-icon1.gif")" title="Hủy giai đoạn" />
                                                </a>
                                                <div class="pull-right">
                                                </div>
                                            }
                                        </td>
                                    </tr>
                                }
                            }
                        }

                    </table>
                </div>
                <div class="row margin-top-05">
                    <div class="pagination-sm">
                        @Html.PagedListPager(Model.SearchResults, page => Url.Action("Index", new
                       {
                           page,
                           Model.gGDOAN_MA,
                           Model.gGDOAN_CSDT_MA,
                       }))
                    </div>
                </div>
            </fieldset>
        </div>
    </div>
</div>

<!-- delete modal placeholder-->
<div id='deleteModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='deleteModalContent'></div>
        </div>
    </div>
</div>

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/modalform")
    <script src="~/Scripts/autocomplete.js"></script>
}
